home *** CD-ROM | disk | FTP | other *** search
- Path: news1.h1.usa.pipeline.com!usenet
- From: grantp@usa.pipeline.com(Pete)
- Newsgroups: comp.lang.c++
- Subject: Re: Faster FILE subroutines in standard C?
- Date: 4 Jan 1996 11:49:20 GMT
- Organization: Pipeline USA
- Message-ID: <4cges0$kqi@news1.usa.pipeline.com>
- References: <4cflbt$d4h@sunburst.ccs.yorku.ca>
- NNTP-Posting-Host: pipe8.h1.usa.pipeline.com
- X-PipeUser: grantp
- X-PipeHub: usa.pipeline.com
- X-PipeGCOS: (Pete)
- X-Newsreader: Pipeline USA v3.3.0
-
- On Jan 04, 1996 04:34:05 in article <Re: Faster FILE subroutines in
- standard C?>, 'ken@yorku.ca (Kenneth Kafieh)' wrote:
-
- >Ken (ken@afep.yorku.ca) wrote:
- >
- >: I found that I was able to get 3-4 time faster performance by using good
-
- >: old ANSI C file accessing routines (like fgets, fseek, ftell, ...etc.)
- >: instead of C++ streams (like ifstream::getline, fstream::seekg, ...etc.)
-
- >: I wrote the program originally in C++ (a simple little phonebook for my
- >: own use) and it took about 9 seconds to scan a 100Kb file for a 3 byte
- >: string!!! Fed up, I rewrote it in C and voila! Now it takes 2 secs!
- >: I'm using Borland C++ v2.0.
- >
- >: Does that sound right?
-
- No.
-
- >: Maybe my code was inefficiently written?
-
- That would be my guess -- given the difference.
-
- >: I know C++ is generally slower than C but I didn't think that
-
- Why do you say that?
-
- >: file stuff would be too. What did I do wrong? Am I missing
- >: something. Maybe I'll post the code too, later. Has anyone
- >: else noticed this too?
- >
- I wouldn't place too much value in the results of an old
- implementation of a library. BC20 was released about five years
- ago so its performace is really not applicable today.
-
- I haven't performed actual tests; however, with today's compiler
- systems there is a negligible apparent difference (if any)
- between stdio and iostreams -- at least in the applications
- I've converted from one to the other.
-
- --
-
- Pete
-